package maggames.games.seega;

import java.awt.Color;
import java.util.LinkedList;

import javax.swing.border.Border;

import maggames.core.base.BaseSwingInterface;
import maggames.core.visual.*;
import maggames.core.Piece;

/**
 * Seega implemented SwingInterface
 * 
 * @author BenjaminPLee
 * @version 1.0
 */
public class SeegaSwingInterface extends BaseSwingInterface {
	private static final long serialVersionUID = -369438904250078100L;
	private SeegaGameEngine gameEngine = null;  //  @jve:decl-index=0:
	
	/**
	 * Main constructor providing the interface with a handle on the game engine
	 * being used.
	 * 
	 * @param engine
	 */
	public SeegaSwingInterface(SeegaGameEngine engine) {
		super(engine);
	}

	/**
	 * This method initializes this
	 * 
	 */
	protected void initialize() {
		super.initialize();
		if(pieces==null) {
			pieces = new LinkedList<VisualPiece>();
		}
		
		for(int i=0; i<12; i++) {
			VisualPiece player1 = getNewPiece(Piece.P1);
			VisualPiece player2 = getNewPiece(Piece.P2);
			int yStart = this.controllerPanel.getHeight() + 10;
			player1.setLocation(5, i*15+yStart);
			player1.setInitialLocation(player1.getLocation());
			player2.setLocation(this.getWidth()-player2.getWidth() - 5, i*15+yStart);
			player2.setInitialLocation(player2.getLocation());
			pieces.add(player1);
			pieces.add(player2);
			this.add(player1);
			this.add(player2);
		}
		spaces[spaces.length/2][spaces.length/2].setBackground(Color.BLACK);
	}

	/**
	 * @return the gameEngine
	 */
	public SeegaGameEngine getGameEngine() {
		return gameEngine;
	}

	/**
	 * @param gameEngine the gameEngine to set
	 */
	public void setGameEngine(SeegaGameEngine gameEngine) {
		this.gameEngine = gameEngine;
	}	
}  //  @jve:decl-index=0:visual-constraint="10,10"
